#include<bits/stdc++.h>
#define int long long
using namespace std;
char buf[1<<23],*p1=buf,*p2=buf,obuf[1<<23],*O=obuf;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
    while(isdigit(ch)) x=x*10+(ch^48),ch=getchar();
    return x*f;
}
inline void write(int x)
{
    if(!x)
        putchar('0');
    char F[200];
    int tmp=x>0?x:-x;
    if(x<0)
        putchar('-');
    int cnt=0;
    while(tmp>0)
        F[cnt++]=tmp%10+'0',tmp/=10;
    while(cnt>0)
        putchar(F[--cnt]);
}
const int N=1e7+5,mod=998244353;
int n,k;
int fac[N],ifac[N],pw[N];
long long ans;
inline int C(int n,int m)
{
	return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
inline int qpow(int x,int y)
{
	int ans=1;
	for(;y;y>>=1,x=1ll*x*x%mod)
		if(y&1) 
			ans=1ll*ans*x%mod;
	return ans;
} 
inline void Mod(int &x)
{
	return (x>=mod)&&(x-=mod),void();
}
signed main()
{
	freopen("length.in","r",stdin);
	freopen("length.out","w",stdout);
	n=read(),k=read();
	fac[0]=ifac[0]=pw[0]=1;
	for(int i=1;i<=n;i++)
	{
		fac[i]=1ll*fac[i-1]*i%mod;
		pw[i]=1ll*pw[i-1]*n%mod;	
	}
	ifac[n]=qpow(fac[n],mod-2);
	for(int i=n-1;i;i--) 
		ifac[i]=1ll*ifac[i+1]*(i+1)%mod;
	for(int i=1;i<=n;++i)
		ans+=1ll*C(n,i)*fac[i-1]%mod*qpow(i,k)%mod*pw[n-i]%mod;
	write(ans%mod);
	putchar('\n')
	return 0;
}

